package com.edu.exam.entity.examination.paper.technical;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import jakarta.persistence.*;
import java.time.LocalDateTime;

/**
 * 主观题详情实体类
 *
 * 根据E-04-01设备适配子模块数据库设计实现
 * 存储每个主观题的详细切分信息。
 *
 * @author System
 * @version 1.0.0
 */

@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class SubjectiveQuestionDetail {

    /**
     * 详情ID，主键
     */
    @Id
    @Column(name = "detail_id", length = 64)
    private String detailId;

    /**
     * 切分结果ID（外键）
     */
    @Column(name = "segmentation_result_id", length = 64, nullable = false)
    private String segmentationResultId;

    /**
     * 识别结果ID（外键）
     */
    @Column(name = "recognition_result_id", length = 64, nullable = false)
    private String recognitionResultId;

    /**
     * 考试ID
     */
    @Column(name = "exam_id", length = 64, nullable = false)
    private String examId;

    /**
     * 题目编号
     */
    @Column(name = "question_id", nullable = false)
    private Integer questionId;

    /**
     * 题目文本
     */
    @Column(name = "question_text", columnDefinition = "TEXT")
    private String questionText;

    /**
     * 区域坐标
     */
    @Column(name = "region_coordinates", length = 256)
    private String regionCoordinates;

    /**
     * 图片路径
     */
    @Column(name = "image_path", length = 512)
    private String imagePath;

    /**
     * 图片宽度
     */
    @Column(name = "image_width")
    private Integer imageWidth;

    /**
     * 图片高度
     */
    @Column(name = "image_height")
    private Integer imageHeight;

    /**
     * 文件大小
     */
    @Column(name = "file_size")
    private Long fileSize;

    /**
     * 质量分数
     */
    @Column(name = "quality_score", precision = 5, scale = 2)
    private Double qualityScore;

    /**
     * 是否人工调整
     */
    @Column(name = "is_manual_adjusted")
    private Boolean isManualAdjusted;

    /**
     * 调整备注
     */
    @Column(name = "adjustment_notes", columnDefinition = "TEXT")
    private String adjustmentNotes;

    /**
     * 创建时间
     */
    @CreationTimestamp
    @Column(name = "created_time", nullable = false, updatable = false)
    private LocalDateTime createdTime;

    /**
     * 更新时间
     */
    @UpdateTimestamp
    @Column(name = "updated_time", nullable = false)
    private LocalDateTime updatedTime;

    /**
     * 版本号
     */
    @Version
    @Column(name = "version", nullable = false)
    private Long version = 0L;

    /**
     * 是否删除
     */
    @Column(name = "is_deleted", nullable = false)
    private Boolean isDeleted = false;
}